package com.lemon.jvm.hotspot.src.share.vm.prims;

import com.lemon.jvm.hotspot.src.share.vm.oops.InstanceKlass;
import com.lemon.jvm.hotspot.src.share.vm.oops.MethodInfo;

public class JavaNativeInterface {

    public static MethodInfo getMethodID(InstanceKlass klass, String name, String descriptorName){
        for(MethodInfo methodInfo:klass.getMethods()){
            String methodName = methodInfo.getMethodName();
            if(!methodName.equals(name)){
                continue;
            }
            String d = klass.getConstantPool().getNameByNameIndex(methodInfo.getDescriptorIndex());
            if(!descriptorName.equals(d)){
                continue;
            }
            return methodInfo;
        }
        return null;
    }
}
